const pool = require("../connection/sqlPool");


async function GETTODAYREC(numRecommendations) {
    const promisePool = pool.promise();
    try {
      const [rows,fileds] = await promisePool.query('SELECT * FROM Today_food');

      const selectedRecommendations = [];
    for(i=0;i<numRecommendations;i++){
        const randomNumber = Math.floor(Math.random() * 60);
        selectedRecommendations.push(rows[randomNumber]);
    }
      return selectedRecommendations



    } catch(err){
        return err.message
    }


  }
  async function GETOCEAN(numRecommendations) {
    const promisePool = pool.promise();
    try {
      const [rows,fileds] = await promisePool.query('SELECT * FROM Ricipe');

      const selectedRecommendations = [];
    for(i=0;i<numRecommendations;i++){
        const randomNumber = Math.floor(Math.random() * 606);
        selectedRecommendations.push(rows[randomNumber]);
    }
      return selectedRecommendations



    } catch(err){
        return err.message
    }


  }




module.exports = {GETTODAYREC,GETOCEAN};